ASM:=nasm
CC:=gcc
LD:=ld
CCFLAGS:=-I ../include -fno-builtin -fno-stack-protector -static -Wall
ASMFLAG:=-f elf
start.o:start.c ../include/protect.h ../include/type.h
	$(CC) $(CCFLAGS) -c $< -g -o $@
pic.o:pic.c ../include/pic.h
	$(CC) $(CCFLAGS) -c $< -g -o $@
gate.o:gate.c ../include/protect.h
	$(CC) $(CCFLAGS) -c $< -g -o $@
kernel.bin:kernel.asm
	$(ASM) $(ASMFLAG) $< -g -o $@
klib.o:klib.asm
	$(ASM) $(ASMFLAG) $< -g -o $@
klib1.o:klib.c ../include/type.h ../include/message.h ../include/protect.h
	$(CC) $(CCFLAGS) -c $< -g -o $@
protect.o:protect.c	../include/protect.h ../include/type.h
	$(CC) $(CCFLAGS) -c $< -g -o $@
main.o:main.c	../include/protect.h ../include/type.h ../include/proc.h ../include/message.h
	$(CC) $(CCFLAGS) -c $< -g -o $@
clock.o:clock.c   ../include/protect.h ../include/pic.h ../include/clock.h
	$(CC) $(CCFLAGS) -c $< -g -o $@
keyboard.o:keyboard.c ../include/keyboard.h ../include/keymap.h  ../include/type.h ../include/pic.h
	$(CC) $(CCFLAGS) -c $< -g -o $@
message.o:message.c ../include/type.h ../include/message.h
	$(CC) $(CCFLAGS) -c $< -g -o $@
kernel.o:kernel.bin start.o klib.o pic.o klib1.o gate.o protect.o main.o \
 clock.o keyboard.o message.o
	$(LD) -Ttext  0x30400  $^ -o $@
.PHONY:all clean
all:kernel.o
clean:klib.o kernel.o start.o pic.o klib1.o gate.o main.o protect.o clock.o \
	message.o
	rm $^
